package com.zp.qualitypractice.Mvp;

import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;

/**
 * Created by izp on 2017/6/11.
 */

public abstract class BaseDelayActivity extends BaseBCActivity {
    private Handler mHandler = new Handler();
    private Runnable mRunnable = new Runnable() {
        @Override
        public void run() {
            initView();
        }
    };

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().getDecorView().post(new Runnable() {
            //直接post的话仍然是再主线程，线性执行，等在当前线程其他任务执行完毕之后再执行这里。
            //但是现在用handlerPost给了一个runnable，就到子线程去了。
            @Override
            public void run() {
                mHandler.post(mRunnable);
            }
        });
    }
    protected abstract void initView();
}
